import org.codehaus.groovy.grails.commons.ApplicationHolder as AH
import com.fourcitizens.playas.*

class BootStrap {

	def beachesCSVLoaderService
	
	
	def csvPath = "resources/playas.csv"
	def csvFile = AH.application.parentContext.getResource("classpath:$csvPath")

    def init = { servletContext ->
		
		if (!Beach.count()) {
			beachesCSVLoaderService.loadBeachesCSVUnefficiently(csvFile.getFile())
		}
		
    }

    def destroy = {
    }

}
